package cn.jingyuan.owl.model.core;

import java.io.Serializable;


/**
 * 标准响应模型
 *
 * @param <D> 响应数据的类型
 */
public class Result<D> implements Serializable {

    /** 编码 */
    protected String code;

    /** 编码消息 */
    protected String codeMsg;

    /** 数据 */
    protected D data;

    public Result() { }

    public Result(String code, String codeMsg) {
        this(code, codeMsg, null);
    }

    public Result(String code, String codeMsg, D data) {
        this.code = code;
        this.codeMsg = codeMsg;
        this.data = data;
    }

    public String getCode() {
        return code;
    }

    public Result<D> setCode(String code) {
        this.code = code;
        return this;
    }

    public String getCodeMsg() {
        return codeMsg;
    }

    public Result<D> setCodeMsg(String codeMsg) {
        this.codeMsg = codeMsg;
        return this;
    }

    public D getData() {
        return data;
    }

    public Result<D> setData(D data) {
        this.data = data;
        return this;
    }

}
